[Unit]
Description=Etcd Server
After=network.target
After=network-online.target
Wants=network-online.target
Documentation=https://github.com/coreos

[Service]
Type=notify
WorkingDirectory={{k8s_install_home}}/etcd/
ExecStart=/usr/local/bin/etcd \
 --name={{ip}} \
 --data-dir={{k8s_install_home}}/etcd \
 --cert-file=/etc/kubernetes/ssl/kubernetes.pem \
 --key-file=/etc/kubernetes/ssl/kubernetes-key.pem \
 --peer-cert-file=/etc/kubernetes/ssl/kubernetes.pem \
 --peer-key-file=/etc/kubernetes/ssl/kubernetes-key.pem \
 --trusted-ca-file=/etc/kubernetes/ssl/k8s-root-ca.pem \
 --peer-trusted-ca-file=/etc/kubernetes/ssl/k8s-root-ca.pem \
 --peer-client-cert-auth \
 --client-cert-auth \
 --listen-peer-urls=https://{{ip}}:2380 \
 --initial-advertise-peer-urls=https://{{ip}}:2380 \
 --listen-client-urls=https://{{ip}}:2379,http://127.0.0.1:2379 \
 --advertise-client-urls=https://{{ip}}:2379 \
 --initial-cluster-token=etcd-cluster-0 \
 --initial-cluster={{etcd_initial}} \
 --initial-cluster-state={{initial_cluster_state}}
Restart=on-failure
RestartSec=5
LimitNOFILE=65536

[Install]
WantedBy=multi-user.target
